package com.hss.questions.stackqueue;

import java.util.Stack;

/**
 *
 * 实现一个包含 min() 函数的栈，该方法返回当前栈中最小的值。
 *
* */

public class StackMinFunction<T> {

    private  Stack<T> dataStack = new Stack<>();
    private  Stack<T> minStack = new Stack<>();

    public void push(T t){
        dataStack.push(t);
//        minStack.push(minStack.isEmpty()?t:Math.min(minStack.peek(), t) );
    }

    public T push(){
        return dataStack.pop();
    }

    public T min(){

        T t =minStack.peek();

        return t;
    }

}
